﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using CanDoo.Core.Data;
using CanDoo.Data;
using CanDoo.Admin.Core.Models;

namespace CanDoo.Oil.Core.Models
{
    /// <summary>
    /// 实体类——采购退货单明细
    /// </summary>
    [Serializable]
    [Description("采购退货单明细")]
    public class InBuyBackDetail :  EntityBase,ICreatedTime, IAudited
    {
        /// <summary>
        ///采购退货单
        /// </summary>
        [Display(Name = "采购退货单")]
        public virtual InBuyBack InBuyBack { get; set; }
        /// <summary>
        ///采购退货单外键
        /// </summary>
        [Display(Name = "采购退货单外键")]
        public long InBuyBackId { get; set; }

        /// <summary>
        ///采购入库明细
        /// </summary>
        [Display(Name = "采购入库明细")]
        public virtual InStoreDetail InStoreDetail { get; set; }
        /// <summary>
        ///采购入库明细外键
        /// </summary>
        [Display(Name = "采购入库明细外键")]
        public long? InStoreDetailId { get; set; }

        /// <summary>
        ///产品
        /// </summary>
        [Display(Name = "产品")]
        public virtual Product Product { get; set; }
        /// <summary>
        ///产品外键
        /// </summary>
        [Display(Name = "产品外键")]
        public long ProductId { get; set; }

        /// <summary>
        /// 入库单明细
        /// </summary>
        [Display(Name = "入库单明细")]
        public virtual InStoreDetail LinkEntity { get; set; }
        /// <summary>
        /// 入库单明细ID
        /// </summary>
        [Display(Name = "入库单明细ID")]
        public long? LinkEntityId { get; set; }


        /// <summary>
        ///单价
        /// </summary>
        [Display(Name = "单价")]
        [Required]
        public double Price { get; set; }

        /// <summary>
        ///数量
        /// </summary>
        [Display(Name = "数量")]
        [Required]
        public double Num { get; set; }

        /// <summary>
        ///金额
        /// </summary>
        [Display(Name = "金额")]
        [Required]
        public double Money { get; set; }

        /// <summary>
        ///收货数量
        /// </summary>
        [Display(Name = "收货数量")]
        [Required]
        public double AlreadyNum { get; set; }

        /// <summary>
        ///收货金额
        /// </summary>
        [Display(Name = "收货金额")]
        [Required]
        public double AlreadyMoney { get; set; }

        /// <summary>
        ///出入库方向1/-1
        /// </summary>
        [Display(Name = "出入库方向")]
        [Required]
        public int Coefficient { get; set; }

        /// <summary>
        ///备注
        /// </summary>
        [Display(Name = "备注")]
        [StringLength(500)]
        public string Remark { get; set; }

        
        #region Implementation of ICreatedTime

        /// <summary>
        /// 获取设置 信息创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime CreatedTime { get; set; }
        #endregion

        #region Implementation of ICreatedAudited

        /// <summary>
        /// 获取或设置 创建者编号
        /// </summary>
        [Display(Name = "创建人")]
        public string CreatorUserId { get; set; }

        #endregion

        #region Implementation of IUpdateAutited

        /// <summary>
        /// 获取或设置 最后更新时间
        /// </summary>
        [Display(Name = "最后更新时间")]
        public DateTime? LastUpdatedTime { get; set; }

        /// <summary>
        /// 获取或设置 最后更新者编号
        /// </summary>
        [Display(Name = "最后更新用户")]
        public string LastUpdatorUserId { get; set; }

        #endregion
    }
}
